//
//  CurrirculumJSONModel.swift
//  DianShangWen
//
//  Created by 周文轩 on 15/4/12.
//  Copyright (c) 2015年 &#21608;&#25991;&#36713;. All rights reserved.
//

import Foundation
import Argo
import Runes

extension Currirculums: Argo.JSONDecodable {
    
    static func create(courseid: String)(title: String)(learningcount: Int)(img: String) -> Currirculums {
        return Currirculums(courseid: courseid, title: title, learningcount: learningcount, img: img)
    }
    
    static func decode(j: JSONValue) -> Currirculums? {
        return Currirculums.create
                <^> j <| "courseid"
                <*> j <| "title"
                <*> j <| "learningcount"
                <*> j <| "img"
    }
}

extension Currirculum: Argo.JSONDecodable {
    
    static func create(pagecont: Int)(curpage: Int)(totalcount: String)(coursecount: Int)(courses: [Currirculums]) -> Currirculum {
        return Currirculum(pagecont: pagecont, curpage: curpage, totalcount: totalcount, coursecount: coursecount, courses: courses)
    }
    
    static func decode(j: JSONValue) -> Currirculum? {
        return Currirculum.create
                <^> j <| "pagecont"
                <*> j <| "curpage"
                <*> j <| "totalcount"
                <*> j <| "coursecount"
                <*> j <|| "courses"
    }
}